package org.imlinker.plugin;

public class PluginItem {

	public PluginItem(final String title, final Class<?> paraClass) {
		this.title = title;
		pluginClass = paraClass;
	}

	public void openPlugin(boolean visible) {
		if (plugin == null) {
			try {
				plugin = (Plugin) pluginClass.newInstance();
			} catch (InstantiationException e) {
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				e.printStackTrace();
			}
		}

		plugin.open(visible);
	}

	public String getName() {
		return title;
	}

	private String title;

	private Plugin plugin = null;
	private Class<?> pluginClass;
}
